﻿#region Using directives

using System;
using System.Diagnostics;
using System.Collections.Generic;

using Weazel.Gezel.Model;
using Weazel.Gezel.Conversions.CodeGeneration;
using Weazel.Gezel.Conversions.Model;

#endregion

// avoid having to prefix the Model object
// with its namespace to please compiler
using GezelModel = Weazel.Gezel.Model.Model;

namespace Weazel.Gezel.Conversions
{
  /// <summary>
  /// Enumerates the possible languages to 
  /// which the Gezel simulation can be 
  /// converted.
  /// </summary>
  public enum TargetLanguage
  {
    /// <summary>
    /// Specifies C# as the target language with
    /// .NET as the underlying platform.
    /// </summary>
    CSharp,

		/// <summary>
		/// Specifies VB.NET as the target language with
		/// .NET as the underlying platform.
		/// </summary>
		VisualBasic,

		/// <summary>
		/// Specifies J# as the target language with
		/// .NET as the underlying platform.
		/// </summary>
		JSharp,

		/// <summary>
		/// Specifies Managed C++ 2005 as the target language with
		/// .NET as the underlying platform.
		/// </summary>
		VisualC,
    
    /// <summary>
    /// Specifies ISO C++ as the target language
    /// with the standard template libraries.
    /// </summary>
    IsoCpp,
  }

  public class ModelConverter
  {
    public ModelConverter()
    {
    }

    /// <summary>
    /// TODO: test
    /// </summary>
    /// <param name="gezelModel"></param>
    /// <returns></returns>
    public SourceFile[] ConvertModel(GezelModel gezelModel, TargetLanguage language)
    {
      Trace.Assert(gezelModel.IsVerified, "Gezel model has not been not verified");
      //Trace.Assert(language == TargetLanguage.CSharp, "Unsupported target language");

			// generate code that executes simulation algorithm
      SoftwareModel softwareModel = new SoftwareModel(gezelModel, language);
                    
      // return conversion results as
      // a collection of source files
      return CodeGenerator.GenerateSourceCode(softwareModel, language);
    }
  }
}
